package utils.compat;

import android.text.TextUtils;
import utils.Reflector;

/* loaded from: classes2.dex */
public class SystemPropertiesCompat {
    public static String get(String key, String def) {
        try {
            return (String) Reflector.on("android.os.SystemProperties").method("get", String.class, String.class).call(key, def);
        } catch (Exception e) {
            e.printStackTrace();
            return def;
        }
    }

    public static String get(String key) {
        try {
            return (String) Reflector.on("android.os.SystemProperties").method("get", String.class).call(key);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static boolean isExist(String key) {
        return !TextUtils.isEmpty(get(key));
    }

    public static int getInt(String key, int def) {
        try {
            return ((Integer) Reflector.on("android.os.SystemProperties").method("getInt", String.class, Integer.TYPE).call(key, Integer.valueOf(def))).intValue();
        } catch (Exception e) {
            e.printStackTrace();
            return def;
        }
    }
}